﻿using System;
using Linq2Crm.ObjectModel.Attributes;

namespace Linq2Crm.ObjectModel.DomainObject
{
	public interface IDomainObject
	{		
		/// <summary>Related to <see cref="CrmEntityMappingAttribute.IDField"/></summary>		
		Guid Id { get; set; }

		/// <summary>Related to <see cref="CrmEntityMappingAttribute.NameField"/></summary>
		string Name { get; set; }

		RecordStateCode StateCode { get; set; }
		
		int StatusCode { get; set; }

		/// <summary>Used to identify whether Entity exists in CRM</summary>
		/// <value>Null equeal to non existed record in CRM</value>
		int? OrigStatusCode { get; set; }

		/// <summary>
		/// Called before object is initializing from Entity
		/// </summary>
		void ConvertingFromEntity();

		/// <summary>
		/// Called when object is initialized from Entity
		/// </summary>
		void ConvertedFromEntity();
		
		/// <summary>
		/// Called before object is converted to CRM entity
		/// </summary>
		void ConvertingToEntity();

		/// <summary>
		/// Called after object has been converted to CRM entity
		/// </summary>
		void ConvertedToEntity();
	}
}